package com.example.qianjun.ninetable;

import android.content.Intent;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by qianjun on 2016/5/24.
 */
public class CheckBoard {
    //显示的盘面
    public static int[][] table = new int[3][3];
    //练习界面数据
    public static int[][] practiceTable = new int[3][3];
    //设置界面数据
    public static int[][] settingtable = new int[3][3];
    //比较盘面
    public static int[][] compareTable = new int[3][3];

    //寻找最佳线路时使用的盘面
    public static int[][] lookingTable = new int[3][3];

    //对应的旋转符号与指令
    public static String[] rotateMark = new String[]{"r1", "r2", "r3", "r4", "R1", "R2", "R3", "R4"};
    public static int[] rotateSign = new int[]{0, 1, 2, 3, 4, 5, 6, 7};

    public static Map<Integer, int[]> map = new HashMap<Integer, int[]>();

    //最终得到的线路终点标志--key
    public static int countFlag = 0;

    public static int getCountFlag() {
        return countFlag;

    }

    public static void setCountFlag(int countFlag) {
        CheckBoard.countFlag = countFlag;
    }

    public static void init() {
        map.clear();
        table[0][0] = 1;
        table[1][0] = 2;
        table[2][0] = 3;
        table[0][1] = 4;
        table[1][1] = 5;
        table[2][1] = 6;
        table[0][2] = 7;
        table[1][2] = 8;
        table[2][2] = 9;

        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                practiceTable[i][j] = table[i][j];
                settingtable[i][j] = table[i][j];
                compareTable[i][j] = table[i][j];
                lookingTable[i][j] = table[i][j];
            }
        }

    }


    public static void tableInit(int[][] table) {
        table[0][0] = 1;
        table[1][0] = 2;
        table[2][0] = 3;
        table[0][1] = 4;
        table[1][1] = 5;
        table[2][1] = 6;
        table[0][2] = 7;
        table[1][2] = 8;
        table[2][2] = 9;
    }

    public static void practiceToShow() {
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                table[i][j] = practiceTable[i][j];
            }
        }
    }


    public static void setTable(int[][] t) {
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                table[i][j] = t[i][j];
            }
        }
    }

    public static void setTable(int[][] t1, int[][] t2) {
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                t1[i][j] = t2[i][j];
            }
        }
    }


}
